<template>
  <div>
    <h1>数据：{{msg}}</h1>
    <button @click="logout">注销</button>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  data() {
    return {
      msg: ''
    }
  },
  methods:{
    logout(){
      localStorage.setItem('token', '')
      location.reload()
    },
    async getMsg(){
      const {data: res} = await this.$http.get('/hello')
      this.msg = res.data[0].msg
    }
  },
  created(){
    this.getMsg()
  }
}
</script>

<style>

</style>